<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>不使用临时变量交换变量的值</title>
</head>
<body>
    <script>
        function swap(a,b)
        {
            a = a+b;
            b = a-b;
            a = a-b;
        }

      var a = 20,b = 30;
      console.log(a,b);
      swap(a,b);
      console.log(a,b);
    </script>
</body>
</html>